package top.jacktgq.dao;

import com.zaxxer.hikari.HikariDataSource;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;
import top.jacktgq.pojo.Userinfo;
import top.jacktgq.utils.HikariUtils;

import javax.management.Query;
import java.sql.SQLException;

/**
 * @Author CandyWall
 * @Date 2021/6/21--15:37
 * @Description
 */
public class AdminDao {

    // 校验管理员登录
    public Userinfo checkLogin(String username, String password) throws SQLException {
        QueryRunner runner = new QueryRunner(HikariUtils.getDataSource());
        return runner.query("select * from userinfo where username=? and password=?", new BeanHandler<Userinfo>(Userinfo.class), username, password);
    }
}
